﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Test.UI.OpenGL.Animations;

/// <summary>
/// 颜色梯度类型（包含对称标志）
/// </summary>
/// <param name="baseType">基础梯度类型</param>
/// <param name="isSymmetric">是否对称，默认为false</param>
public struct ColorGradientType(GradientBaseType baseType, bool isSymmetric = false)
{
    /// <summary>
    /// 获取或设置基础梯度类型
    /// </summary>
    public GradientBaseType BaseType { get; set; } = baseType;

    /// <summary>
    /// 获取或设置是否对称
    /// </summary>
    public bool IsSymmetric { get; set; } = isSymmetric;

    // 预定义的常用梯度类型
    /// <summary>
    /// 经典梯度类型
    /// </summary>
    public static readonly ColorGradientType Classic = new(GradientBaseType.Classic, false);

    /// <summary>
    /// 对称经典梯度类型
    /// </summary>
    public static readonly ColorGradientType ClassicSymmetric = new(GradientBaseType.Classic, true);

    /// <summary>
    /// 热力梯度类型
    /// </summary>
    public static readonly ColorGradientType Thermal = new(GradientBaseType.Thermal, false);

    /// <summary>
    /// 对称热力梯度类型
    /// </summary>
    public static readonly ColorGradientType ThermalSymmetric = new(GradientBaseType.Thermal, true);

    /// <summary>
    /// 彩虹梯度类型
    /// </summary>
    public static readonly ColorGradientType Rainbow = new(GradientBaseType.Rainbow, false);

    /// <summary>
    /// 对称彩虹梯度类型
    /// </summary>
    public static readonly ColorGradientType RainbowSymmetric = new(GradientBaseType.Rainbow, true);

    /// <summary>
    /// 单色梯度类型
    /// </summary>
    public static readonly ColorGradientType Monochrome = new(GradientBaseType.Monochrome, false);

    /// <summary>
    /// 对称单色梯度类型
    /// </summary>
    public static readonly ColorGradientType MonochromeSymmetric = new(GradientBaseType.Monochrome, true);

    /// <summary>
    /// 海洋梯度类型
    /// </summary>
    public static readonly ColorGradientType Ocean = new(GradientBaseType.Ocean, false);

    /// <summary>
    /// 对称海洋梯度类型
    /// </summary>
    public static readonly ColorGradientType OceanSymmetric = new(GradientBaseType.Ocean, true);

    /// <summary>
    /// 火焰梯度类型
    /// </summary>
    public static readonly ColorGradientType Fire = new(GradientBaseType.Fire, false);

    /// <summary>
    /// 对称火焰梯度类型
    /// </summary>
    public static readonly ColorGradientType FireSymmetric = new(GradientBaseType.Fire, true);

    /// <summary>
    /// 返回当前颜色梯度类型的字符串表示
    /// </summary>
    /// <returns>如果是对称类型则返回"基础类型+Symmetric"，否则返回基础类型名称</returns>
    public override readonly string ToString()
    {
        return IsSymmetric ? $"{BaseType}Symmetric" : BaseType.ToString();
    }
}